package com.czk.service.impl;

import com.czk.model.TbOrder;
import com.czk.service.OrderService;
import com.czk.mapper.OrderMapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/10/21 14:36
 */
@Service
public class OrderServiceImpl implements OrderService {
    @Resource
    private OrderMapper orderMapper;

    @Override
    public void add(TbOrder order) {
        // 获取购物车中的商品数据信息
        // 统计计算
        // 组装订单信息，并保存订单
        // 组装订单明细信息，并保存对应的订单明细
        // 保存订单日志信息

    }

    @Override
    public Page search(Map<String, String> searchMap, Integer page, Integer size) {
        PageHelper.startPage(page, size);
        // 执行分页查询
        List<TbOrder> search = orderMapper.search(searchMap);
        // 强转
        return (Page) search;
    }
}
